<!doctype html>
<html ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <title>$watch</title>
</head>
<body>

<div ng-controller="MyController">
    <input type="text" ng-model="ss.id"/>
     <input type="text" ng-model="ss.name"/>
   <button ng-click="tijiao()">提交</button>{{sss}}
   <button ng-click="tijiao2()">提交2</button>{{sss2}}
   <button ng-click="tijiao3()">提交3</button> 
   <button ng-click="tijiao4()">提交4</button> 
</div>

<script src="angularjs.js"></script>
<script>
    angular.module('myApp', [ ]);
    angular.module('myApp').controller("MyController", ["$scope", "$http",function ($scope, $http) {
                $scope.ss={
                	id:1,
                	name:'duhao'
                };
                $scope.tijiao = function () {
                 //   $http.post("http://localhost/jersey-eclipse/api/test"?id=$scope.ss.id&name=$scope.ss.name, param).success(function (data) {             
                    $http.get("http://localhost:8080/jersy-eclipse-git/api/test").success(function (data) {             
				 		$scope.sss = data;
                    	console.log(data);
                    }).error(function (error) {
                        console.log(error);
                    })
                };
                $scope.tijiao2 =function(){
                	  $http.get("http://localhost:8080/jersy-eclipse-git/api/test/test2?id=2&name=sss").success(function (data) {             
                   // $http.get("http://localhost:8080/jersey-eclipse/api/test").success(function (data) {             
				 		$scope.sss2 = data;
                    	console.log(data);
                    }).error(function (error) {
                        console.log(error);
                    })
                };
                $scope.tijiao3 =function(){
              	  $http.get("http://localhost:8080/jersy-eclipse-git/api/test/test3").success(function (data) {                        
              		$scope.ss =data;
                  
                  }).error(function (error) {
                      console.log(error);
                  })
              };
              $scope.tijiao4 =function(){
              	  $http.post("http://localhost:8080/jersy-eclipse-git/api/test",$scope.ss).success(function (data) {                        
              		$scope.ss =data;
                  
                  }).error(function (error) {
                      console.log(error);
                  })
              };
            }]);
</script>
</body>
</html>



